home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-03-06 | 1.9 KB | 90 lines | [TEXT/MPCC] |
- /*********************/
- /* BLITTER.C */
- /*********************/
- //
- // This file contains the "poor man's profiler" and
- // the screen blitter routine.
- //
-
- /****************************/
- /* EXTERNALS */
- /****************************/
-
- extern Ptr gScreenAddr,gDrawBufferPtr;
- extern long gScreenRowBytes;
-
-
- /****************************/
- /* PROTOTYPES */
- /****************************/
-
- void ProfileIt(void);
- static void BlitBufferToScreen(void);
-
-
- /****************************/
- /* CONSTANTS */
- /****************************/
-
-
- /****************************/
- /* VARIABLES */
- /****************************/
-
-
-
- /********************* PROFILE IT *********************/
- //
- // Calls the blitter routine 1000 times and does a
- // beep at the beginning and end so you can time in
- // on a stopwatch.
- //
-
- void ProfileIt(void)
- {
- long i;
-
- SysBeep(0); // MAKE 1ST BEEP SOUND
-
- for (i=0; i < 1000L; i++) // blit the buffer 1000 times
- BlitBufferToScreen();
-
- SysBeep(0); // MAKE 2ND BEEP SOUND
- }
-
-
- /*************** BLIT BUFFER TO SCREEN ****************/
- //
- // This is a partially optimized blitter routine which
- // will blit the 640x480 buffer to the screen.
- //
- // This has been optimized by using doubles to copy 8 bytes
- // of data at a time.
- //
- // On a PowerMac 6100/60 it takes approximately 15 seconds
- // to execute this 1000 times.
- //
-
- static void BlitBufferToScreen(void)
- {
- long x,y;
- double *destPtr,*srcPtr;
- Ptr destStartPtr;
-
- srcPtr = (double *)gDrawBufferPtr; // get ptr to start of buffer
- destStartPtr = gScreenAddr; // get ptr to start of scan line
-
- for(y=0; y < 480; y++)
- {
- destPtr = (double *)destStartPtr; // set destPtr to start of line
-
- for (x=0; x < (640/8); x++) // copy a line with 8-byte doubles
- *destPtr++ = *srcPtr++;
-
- destStartPtr += gScreenRowBytes; // skip to next scan line
- }
- }
-
-
-
-